# -*- coding: utf-8 -*-
import sys
import os
os.chdir(sys.path[0])
import logging_config
import tornado.ioloop
import tornado.web
import tornado.websocket
from tornado.options import define, options
from radiocaca_handler import RadiocacaHandler
from radiocaca_manager import radiocaca_manager


define('port', default=9000, help="The tornado server port", type=int)


if __name__ == '__main__':
    options.parse_command_line()
    app = tornado.web.Application(handlers=[
        (r"/radiocaca", RadiocacaHandler),
    ])
    http_server = tornado.web.HTTPServer(app)
    app.listen(options.port)

    radiocaca_manager.start()
    tornado.ioloop.IOLoop.current().start()
